<?php
App::uses('AppController', 'Controller');
/**
 * Instructions Controller
 *
 * @property Instruction $Instruction
*/
class InstructionsController extends AppController {
	// элементы меню правой колонки шаблона defaultwsb
	public $SideBarItems = array();
	// сообщения выводимые в правой колонке под меню при использовании шаблона defaultwsb
	public $SideBarMessage = '';
	public $HMenu = '';
	public $VMenu = '';
	
	// id пользователя  он же id teacher  он же id author
	public $SessionUserData = '';
		
	public function index () {
		// устанавливаем активный пункт меню в верхем меню
		$this->set('HMenu', 'Instruction');		
		
		$this->loadModel('Recordtype');
		$items = array('1' => 'Заполнение профиля пользователя', '2' => 'Работа с соавторами');
		$recordtypes = $this->Recordtype->find('list');
		foreach ($recordtypes as $recordtype):
			array_push($items, $recordtype);
		endforeach;
		//$full_items = array_merge($items, $recordtypes);
		//debug ($items);
		
		$this->set(compact('items'));
	}
	
	public function showinstruction() {
		// устанавливаем активный пункт меню в верхем меню
		$this->set('HMenu', 'Instruction');		
		$recordtype_id = $this->data['Instruction']['recordtype_id'];
		
		if (!empty($recordtype_id)) {
			$this->loadModel('Recordtype');
			$items = array('1' => 'Заполнение профиля пользователя', '2' => 'Работа с соавторами');
			$recordtypes = $this->Recordtype->find('list');
			foreach ($recordtypes as $recordtype):
			array_push($items, $recordtype);
			endforeach;
			
			$this->set('recordtype_id',$recordtype_id);
			
			$this->set('topic', $items[$recordtype_id]);
		}
		
		switch ($recordtype_id) {
			case 1: $this->render('show.1');break;
			case 2: $this->render('show.2');break;
			case 3: $this->render('show.3');break;
			case 4: $this->render('show.4');break;
			case 5: $this->render('show.5');break;
			case 6: $this->render('show.6');break;
			case 7: $this->render('show.7');break;
			case 8: $this->render('show.8');break;
			case 9: $this->render('show.9');break;
			case 10: $this->render('show.10');break;
			case 11: $this->render('show.11');break;
			case 12: $this->render('show.12');break;
			case 13: $this->render('show.13');break;
			case 14: $this->render('show.14');break;
			case 15: $this->render('show.15');break;
			case 16: $this->render('show.16');break;
			case 17: $this->render('show.17');break;
			case 18: $this->render('show.18');break;
			case 19: $this->render('show.19');break;
			case 20: $this->render('show.20');break;
			case 21: $this->render('show.21');break;
			case 22: $this->render('show.22');break;
			case 23: $this->render('show.23');break;
			case 24: $this->render('show.24');break;
			case 25: $this->render('show.25');break;
			case 26: $this->render('show.26');break;
			case 27: $this->render('show.27');break;
			case 28: $this->render('show.28');break;
			case 29: $this->render('show.29');break;
			case 30: $this->render('show.30');break;
			case 31: $this->render('show.31');break;
			case 32: $this->render('show.32');break;
			case 33: $this->render('show.33');break;
			case 34: $this->render('show.34');break;
			case 35: $this->render('show.35');break;
			case 36: $this->render('show.36');break;
			case 37: $this->render('show.37');break;
			case 38: $this->render('show.38');break;
			case 39: $this->render('show.39');break;
			case 40: $this->render('show.40');break;			
			case 41: $this->render('show.41');break;
			case 42: $this->render('show.42');break;
			case 43: $this->render('show.43');break;
			case 44: $this->render('show.44');break;
			// значение по умолчанию когда не выбрали никакой пункт из списка
			default: $this->redirect(array('action' => 'index'));
		}
	}
	
	public function pologenie() {
		$this->layout = 'blank';
	}
}